package com.mk.admin.controller;

import com.mk.admin.model.ResultDto;
import com.mk.admin.model.vo.MessageVo;
import com.mk.admin.service.MessageService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/a/adm/message")
@Api(tags = "消息通知")
public class MessageController {
    @Autowired
    private MessageService messageService;

    @PostMapping("/select")
    public ResultDto select(@RequestBody MessageVo vo) {
        return messageService.select(vo);
    }

    @PostMapping("/add")
    public ResultDto add(@RequestBody MessageVo vo) {
        return messageService.add(vo);
    }

    @PostMapping("/update")
    public ResultDto update(@RequestBody MessageVo vo) {
        return messageService.update(vo);
    }

    @PostMapping("/delete")
    public ResultDto delete(@RequestBody MessageVo vo) {
        return messageService.delete(vo.getId());
    }

    @PostMapping("/status")
    public ResultDto status(@RequestBody MessageVo vo) {
        return messageService.status(vo.getId());
    }
}
